#ifndef _DMA2D_H_
#define _DMA2D_H_

#include "stm32h7xx_hal.h"

struct DMA2DParam
{
    uint32_t pSrc;
    uint32_t pDst;
    uint16_t x;
    uint16_t y;
    uint16_t xSize;
    uint16_t ySize;
    uint32_t chromaSampling;
    uint32_t outputPixelFormat;

    uint32_t inputLineOffset;
    uint32_t cssMode;
    uint8_t bytePerPixel;
};

static inline void DMA2DParamSetSrc(DMA2DParam &param, uint32_t value)
{
    param.pSrc = value;
}

static inline void DMA2DParamSetDst(DMA2DParam &param, uint32_t value)
{
    param.pDst = value;
}

static inline void DMA2DParamSetX(DMA2DParam &param, uint16_t value)
{
    param.x = value;
}

static inline void DMA2DParamSetY(DMA2DParam &param, uint16_t value)
{
    param.y = value;
}

static inline void DMA2DParamSetXSize(DMA2DParam &param, uint16_t value)
{
    param.xSize = value;
}

static inline void DMA2DParamSetYSize(DMA2DParam &param, uint16_t value)
{
    param.ySize = value;
}

static inline void DMA2DParamSetChromaSampling(DMA2DParam &param, uint32_t value)
{
    param.chromaSampling = value;
}

static inline void DMA2DParamSetOutputPixelFormat(DMA2DParam &param, uint32_t value)
{
    param.outputPixelFormat = value;
}

void DMA2D_CopyYCbCrToRGB(DMA2DParam &param);


#endif
